home *** CD-ROM | disk | FTP | other *** search
- From: Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
- Date: Tue, 24 May 94 11:37:07 +0200
- Message-Id: <9405240937.AA27390@issan.informatik.uni-dortmund.de>
- To: mint@atari.archive.umich.edu
- Subject: MiNTlib: support for MFS_MKNOD
-
- This patch add support for MFS_MKNOD to mknod. This is mainly useful
- for unpacking the Linux root filesystem under MiNT, with its device
- files under /dev.
-
- Thanks to Stephen for adding MFS_MKNOD to MinixFS.
-
- *** orig/mknod.c Tue Oct 12 20:05:16 1993
- --- mknod.c Sat May 21 23:41:02 1994
- ***************
- *** 1,20 ****
- ! /* fake mknod -- this always fails */
-
- #include <errno.h>
- #include <support.h>
- #include <stat.h>
-
- int
- mknod(path, mode, dev)
- ! char *path;
- int mode, dev;
- {
- if (S_ISDIR(mode)) {
- return (mkdir(path, (mode_t) mode));
- }
- ! if (S_ISFIFO(mode)) {
- ! return (mkfifo(path, (mode_t) mode));
- ! }
- ! errno = EINVAL;
- ! return -1;
- }
- --- 1,34 ----
- ! /* fake mknod -- this always fails, except with MinixFS 0.06pl10 or later */
-
- #include <errno.h>
- #include <support.h>
- #include <stat.h>
- + #include <limits.h>
- + #include <types.h>
- + #include <mintbind.h>
- + #include <errno.h>
- + #include "lib.h"
- +
- + #define MFS_MKNOD 0x10f
-
- int
- mknod(path, mode, dev)
- ! const char *path;
- int mode, dev;
- {
- + long err, magic;
- + char _path[PATH_MAX];
- +
- if (S_ISDIR(mode)) {
- return (mkdir(path, (mode_t) mode));
- }
- ! _unx2dos (path, _path);
- ! err = Dcntl (MFS_MKNOD, _path,
- ! ((long) mode & 0xffff) | ((long) dev << 16));
- ! if (err < 0)
- ! {
- ! errno = -err;
- ! return -1;
- ! }
- ! return 0;
- }
-